# SPDX-License-Identifier: ((GPL-2.0 WITH Linux-syscall-note) OR BSD-3-Clause)
---
name: sunrpc
protocol: genetlink
uapi-header: linux/sunrpc_netlink.h

doc: SUNRPC cache upcall support over generic netlink.

definitions:
  -
    type: flags
    name: cache-type
    entries: [ip_map, unix_gid]

attribute-sets:
  -
    name: cache-notify
    attributes:
      -
        name: cache-type
        type: u32
        enum: cache-type
  -
    name: ip-map
    attributes:
      -
        name: seqno
        type: u64
      -
        name: class
        type: string
      -
        name: addr
        type: string
      -
        name: domain
        type: string
      -
        name: negative
        type: flag
      -
        name: expiry
        type: u64
  -
    name: ip-map-reqs
    attributes:
      -
        name: requests
        type: nest
        nested-attributes: ip-map
        multi-attr: true
  -
    name: unix-gid
    attributes:
      -
        name: seqno
        type: u64
      -
        name: uid
        type: u32
      -
        name: gids
        type: u32
        multi-attr: true
      -
        name: negative
        type: flag
      -
        name: expiry
        type: u64
  -
    name: unix-gid-reqs
    attributes:
      -
        name: requests
        type: nest
        nested-attributes: unix-gid
        multi-attr: true
  -
    name: cache-flush
    attributes:
      -
        name: mask
        type: u32
        enum: cache-type
        enum-as-flags: true

operations:
  list:
    -
      name: cache-notify
      doc: Notification that there are cache requests that need servicing
      attribute-set: cache-notify
      mcgrp: exportd
      event:
        attributes:
          - cache-type
    -
      name: ip-map-get-reqs
      doc: Dump all pending ip_map requests
      attribute-set: ip-map-reqs
      flags: [admin-perm]
      dump:
          reply:
            attributes:
              - requests
    -
      name: ip-map-set-reqs
      doc: Respond to one or more ip_map requests
      attribute-set: ip-map-reqs
      flags: [admin-perm]
      do:
          request:
            attributes:
              - requests
    -
      name: unix-gid-get-reqs
      doc: Dump all pending unix_gid requests
      attribute-set: unix-gid-reqs
      flags: [admin-perm]
      dump:
          reply:
            attributes:
              - requests
    -
      name: unix-gid-set-reqs
      doc: Respond to one or more unix_gid requests
      attribute-set: unix-gid-reqs
      flags: [admin-perm]
      do:
          request:
            attributes:
              - requests
    -
      name: cache-flush
      doc: Flush sunrpc caches (ip_map and/or unix_gid)
      attribute-set: cache-flush
      flags: [admin-perm]
      do:
        request:
          attributes:
            - mask

mcast-groups:
  list:
    -
      name: none
    -
      name: exportd
