tech-userlevel archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: bumping library major on release branch?



On Wed, Jun 22, 2011 at 02:01:43AM +0000, David Holland wrote:
> Since -current has a different major number from -5 (because of this
> and other changes) introducing these into current would serve no real
> purpose and potentially make a mess.
> 
> Introducing them just into -5 seems fine though, assuming you intend
> the usual __RENAME method.

Attached is a first attempt at it. I am not sure of how to use __RENAME()
here. Any comment?

-- 
Emmanuel Dreyfus
manu%netbsd.org@localhost
Index: src/lib/libpuffs/dispatcher.c
===================================================================
RCS file: /cvsroot/src/lib/libpuffs/dispatcher.c,v
retrieving revision 1.32.4.1
diff -U4 -r1.32.4.1 dispatcher.c
--- src/lib/libpuffs/dispatcher.c       18 Oct 2009 12:46:07 -0000      1.32.4.1
+++ src/lib/libpuffs/dispatcher.c       23 Jun 2011 15:10:12 -0000
@@ -241,8 +241,31 @@
                        pops->puffs_fs_suspend(pu, auxt->pvfsr_status);
                        break;
                }
 
+               case PUFFS_VFS_EXTATTRCTL:
+               {
+                       struct puffs_vfsmsg_extattrctl *auxt = auxbuf;
+                       const char *attrname;
+                       int flags;
+
+                       if (pops->puffs_fs_extattrctl == NULL) {
+                               error = EOPNOTSUPP;
+                               break;
+                       }
+
+                       if (auxt->pvfsr_flags & PUFFS_EXTATTRCTL_HASATTRNAME)
+                               attrname = auxt->pvfsr_attrname;
+                       else
+                               attrname = NULL;
+
+                       flags = auxt->pvfsr_flags & PUFFS_EXTATTRCTL_HASNODE;
+                       error = pops->puffs_fs_extattrctl(pu, auxt->pvfsr_cmd,
+                           opcookie, flags,
+                           auxt->pvfsr_attrnamespace, attrname);
+                       break;
+               }
+
                default:
                        /*
                         * I guess the kernel sees this one coming
                         */
@@ -907,8 +930,125 @@
                            opcookie, &auxt->pvnr_events);
                        break;
                }
 
+               case PUFFS_VN_GETEXTATTR:
+               {
+                       struct puffs_vnmsg_getextattr *auxt = auxbuf;
+                       PUFFS_MAKECRED(pcr, &auxt->pvnr_cred);
+                       size_t res, *resp, *sizep;
+                       uint8_t *data;
+
+                       if (pops->puffs_node_getextattr == NULL) {
+                               error = EOPNOTSUPP;
+                               break;
+                       }
+
+                       if (auxt->pvnr_datasize)
+                               sizep = &auxt->pvnr_datasize;
+                       else
+                               sizep = NULL;
+
+                       res = auxt->pvnr_resid;
+                       if (res > 0) {
+                               data = auxt->pvnr_data;
+                               resp = &auxt->pvnr_resid;
+                       } else {
+                               data = NULL;
+                               resp = NULL;
+                       }
+
+                       error = pops->puffs_node_getextattr(pu,
+                           opcookie, auxt->pvnr_attrnamespace,
+                           auxt->pvnr_attrname, sizep, data, resp, pcr);
+
+                       /* need to move a bit more? */
+                       preq->preq_buflen =
+                           sizeof(struct puffs_vnmsg_getextattr)
+                           + (res - auxt->pvnr_resid);
+                       break;
+               }
+
+               case PUFFS_VN_SETEXTATTR:
+               {
+                       struct puffs_vnmsg_setextattr *auxt = auxbuf;
+                       PUFFS_MAKECRED(pcr, &auxt->pvnr_cred);
+                       size_t *resp;
+                       uint8_t *data;
+
+                       if (pops->puffs_node_setextattr == NULL) {
+                               error = EOPNOTSUPP;
+                               break;
+                       }
+
+                       if (auxt->pvnr_resid > 0) {
+                               data = auxt->pvnr_data;
+                               resp = &auxt->pvnr_resid;
+                       } else {
+                               data = NULL;
+                               resp = NULL;
+                       }
+
+                       error = pops->puffs_node_setextattr(pu,
+                           opcookie, auxt->pvnr_attrnamespace,
+                           auxt->pvnr_attrname, data, resp, pcr);
+                       break;
+               }
+
+               case PUFFS_VN_LISTEXTATTR:
+               {
+                       struct puffs_vnmsg_listextattr *auxt = auxbuf;
+                       PUFFS_MAKECRED(pcr, &auxt->pvnr_cred);
+                       size_t res, *resp, *sizep;
+                       uint8_t *data;
+
+                       if (pops->puffs_node_listextattr == NULL) {
+                               error = EOPNOTSUPP;
+                               break;
+                       }
+
+                       if (auxt->pvnr_datasize)
+                               sizep = &auxt->pvnr_datasize;
+                       else
+                               sizep = NULL;
+
+                       res = auxt->pvnr_resid;
+                       if (res > 0) {
+                               data = auxt->pvnr_data;
+                               resp = &auxt->pvnr_resid;
+                       } else {
+                               data = NULL;
+                               resp = NULL;
+                       }
+
+                       res = auxt->pvnr_resid;
+                       error = pops->puffs_node_listextattr(pu,
+                           opcookie, auxt->pvnr_attrnamespace,
+                           sizep, data, resp, pcr);
+
+                       /* need to move a bit more? */
+                       preq->preq_buflen =
+                           sizeof(struct puffs_vnmsg_listextattr)
+                           + (res - auxt->pvnr_resid);
+                       break;
+               }
+
+               case PUFFS_VN_DELETEEXTATTR:
+               {
+                       struct puffs_vnmsg_deleteextattr *auxt = auxbuf;
+                       PUFFS_MAKECRED(pcr, &auxt->pvnr_cred);
+
+                       if (pops->puffs_node_deleteextattr == NULL) {
+                               error = EOPNOTSUPP;
+                               break;
+                       }
+
+                       error = pops->puffs_node_deleteextattr(pu,
+                           opcookie, auxt->pvnr_attrnamespace,
+                           auxt->pvnr_attrname, pcr);
+                       break;
+               }
+
                default:
                        printf("inval op %d\n", preq->preq_optype);
                        error = EINVAL;
                        break;
Index: src/lib/libpuffs/puffs.c
===================================================================
RCS file: /cvsroot/src/lib/libpuffs/puffs.c,v
retrieving revision 1.92.4.5
diff -U4 -r1.92.4.5 puffs.c
--- src/lib/libpuffs/puffs.c    18 Jun 2011 16:17:38 -0000      1.92.4.5
+++ src/lib/libpuffs/puffs.c    23 Jun 2011 15:10:12 -0000
@@ -100,8 +100,13 @@
        FILLOP(read,     READ);
        FILLOP(write,    WRITE);
        FILLOP(advlock,  ADVLOCK);
        FILLOP(abortop,  ABORTOP);
+
+       FILLOP(getextattr,  GETEXTATTR);
+       FILLOP(setextattr,  SETEXTATTR);
+       FILLOP(listextattr, LISTEXTATTR);
+       FILLOP(deleteextattr, DELETEEXTATTR);
 }
 #undef FILLOP
 
 /*
@@ -597,11 +602,12 @@
        errno = sverrno;
        return rv;
 }
 
+
 /*ARGSUSED*/
 struct puffs_usermount *
-_puffs_init(int dummy, struct puffs_ops *pops, const char *mntfromname,
+_puffs_init52(int dummy, struct puffs_ops *pops, const char *mntfromname,
        const char *puffsname, void *priv, uint32_t pflags)
 {
        struct puffs_usermount *pu;
        struct puffs_kargs *pargs;
@@ -676,8 +682,57 @@
        errno = sverrno;
        return NULL;
 }
 
+struct puffs_usermount *
+_puffs_init(int dummy, struct puffs_ops51 *pops51, const char *mntfromname,
+       const char *puffsname, void *priv, uint32_t pflags) 
+{
+       struct puffs_ops *pops;
+
+       PUFFSOP_INIT(pops);
+
+       pops->puffs_fs_unmount = pops51->puffs_fs_unmount;
+       pops->puffs_fs_statvfs = pops51->puffs_fs_statvfs;
+       pops->puffs_fs_sync = pops51->puffs_fs_sync;
+       pops->puffs_fs_fhtonode = pops51->puffs_fs_fhtonode;
+       pops->puffs_fs_nodetofh = pops51->puffs_fs_nodetofh;
+       pops->puffs_node_lookup = pops51->puffs_node_lookup;
+       pops->puffs_node_create = pops51->puffs_node_create;
+       pops->puffs_node_mknod = pops51->puffs_node_mknod;
+       pops->puffs_node_open = pops51->puffs_node_open;
+       pops->puffs_node_close = pops51->puffs_node_close;
+       pops->puffs_node_access = pops51->puffs_node_access;
+       pops->puffs_node_getattr = pops51->puffs_node_getattr;
+       pops->puffs_node_setattr = pops51->puffs_node_setattr;
+       pops->puffs_node_poll = pops51->puffs_node_poll;
+       pops->puffs_node_mmap = pops51->puffs_node_mmap;
+       pops->puffs_node_fsync = pops51->puffs_node_fsync;
+       pops->puffs_node_seek = pops51->puffs_node_seek;
+       pops->puffs_node_remove = pops51->puffs_node_remove;
+       pops->puffs_node_link = pops51->puffs_node_link;
+       pops->puffs_node_rename = pops51->puffs_node_rename;
+       pops->puffs_node_mkdir = pops51->puffs_node_mkdir;
+       pops->puffs_node_rmdir = pops51->puffs_node_rmdir;
+       pops->puffs_node_symlink = pops51->puffs_node_symlink;
+       pops->puffs_node_readdir = pops51->puffs_node_readdir;
+       pops->puffs_node_readlink = pops51->puffs_node_readlink;
+       pops->puffs_node_reclaim = pops51->puffs_node_reclaim;
+       pops->puffs_node_inactive = pops51->puffs_node_inactive;
+       pops->puffs_node_print = pops51->puffs_node_print;
+       pops->puffs_node_pathconf = pops51->puffs_node_pathconf;
+       pops->puffs_node_advlock = pops51->puffs_node_advlock;
+       pops->puffs_node_read = pops51->puffs_node_read;
+       pops->puffs_node_write = pops51->puffs_node_write;
+       pops->puffs_node_abortop = pops51->puffs_node_abortop;
+
+       free(pops51);
+       
+       return _puffs_init52(dummy, pops, mntfromname, 
+                            puffsname, priv, pflags);
+}
+
+
 void
 puffs_cancel(struct puffs_usermount *pu, int error)
 {
 
Index: src/lib/libpuffs/puffs.h
===================================================================
RCS file: /cvsroot/src/lib/libpuffs/puffs.h,v
retrieving revision 1.108.4.4
diff -U4 -r1.108.4.4 puffs.h
--- src/lib/libpuffs/puffs.h    27 Oct 2009 20:37:38 -0000      1.108.4.4
+++ src/lib/libpuffs/puffs.h    23 Jun 2011 15:10:12 -0000
@@ -149,8 +149,84 @@
 
 extern const struct mntopt puffsmopts[]; /* puffs.c */
 
 /* callbacks for operations */
+struct puffs_ops51 {
+       int (*puffs_fs_unmount)(struct puffs_usermount *, int);
+       int (*puffs_fs_statvfs)(struct puffs_usermount *, struct statvfs *);
+       int (*puffs_fs_sync)(struct puffs_usermount *, int,
+           const struct puffs_cred *);
+       int (*puffs_fs_fhtonode)(struct puffs_usermount *, void *, size_t,
+           struct puffs_newinfo *);
+       int (*puffs_fs_nodetofh)(struct puffs_usermount *, puffs_cookie_t,
+           void *, size_t *);
+       void (*puffs_fs_suspend)(struct puffs_usermount *, int);
+
+       int (*puffs_node_lookup)(struct puffs_usermount *,
+           puffs_cookie_t, struct puffs_newinfo *, const struct puffs_cn *);
+       int (*puffs_node_create)(struct puffs_usermount *,
+           puffs_cookie_t, struct puffs_newinfo *, const struct puffs_cn *,
+           const struct vattr *);
+       int (*puffs_node_mknod)(struct puffs_usermount *,
+           puffs_cookie_t, struct puffs_newinfo *, const struct puffs_cn *,
+           const struct vattr *);
+       int (*puffs_node_open)(struct puffs_usermount *,
+           puffs_cookie_t, int, const struct puffs_cred *);
+       int (*puffs_node_close)(struct puffs_usermount *,
+           puffs_cookie_t, int, const struct puffs_cred *);
+       int (*puffs_node_access)(struct puffs_usermount *,
+           puffs_cookie_t, int, const struct puffs_cred *);
+       int (*puffs_node_getattr)(struct puffs_usermount *,
+           puffs_cookie_t, struct vattr *, const struct puffs_cred *);
+       int (*puffs_node_setattr)(struct puffs_usermount *,
+           puffs_cookie_t, const struct vattr *, const struct puffs_cred *);
+       int (*puffs_node_poll)(struct puffs_usermount *, puffs_cookie_t, int *);
+       int (*puffs_node_mmap)(struct puffs_usermount *,
+           puffs_cookie_t, vm_prot_t, const struct puffs_cred *);
+       int (*puffs_node_fsync)(struct puffs_usermount *,
+           puffs_cookie_t, const struct puffs_cred *, int, off_t, off_t);
+       int (*puffs_node_seek)(struct puffs_usermount *,
+           puffs_cookie_t, off_t, off_t, const struct puffs_cred *);
+       int (*puffs_node_remove)(struct puffs_usermount *,
+           puffs_cookie_t, puffs_cookie_t, const struct puffs_cn *);
+       int (*puffs_node_link)(struct puffs_usermount *,
+           puffs_cookie_t, puffs_cookie_t, const struct puffs_cn *);
+       int (*puffs_node_rename)(struct puffs_usermount *,
+           puffs_cookie_t, puffs_cookie_t, const struct puffs_cn *,
+           puffs_cookie_t, puffs_cookie_t, const struct puffs_cn *);
+       int (*puffs_node_mkdir)(struct puffs_usermount *,
+           puffs_cookie_t, struct puffs_newinfo *, const struct puffs_cn *,
+           const struct vattr *);
+       int (*puffs_node_rmdir)(struct puffs_usermount *,
+           puffs_cookie_t, puffs_cookie_t, const struct puffs_cn *);
+       int (*puffs_node_symlink)(struct puffs_usermount *,
+           puffs_cookie_t, struct puffs_newinfo *, const struct puffs_cn *,
+           const struct vattr *,
+           const char *);
+       int (*puffs_node_readdir)(struct puffs_usermount *,
+           puffs_cookie_t, struct dirent *, off_t *, size_t *,
+           const struct puffs_cred *, int *, off_t *, size_t *);
+       int (*puffs_node_readlink)(struct puffs_usermount *,
+           puffs_cookie_t, const struct puffs_cred *, char *, size_t *);
+       int (*puffs_node_reclaim)(struct puffs_usermount *, puffs_cookie_t);
+       int (*puffs_node_inactive)(struct puffs_usermount *, puffs_cookie_t);
+       int (*puffs_node_print)(struct puffs_usermount *, puffs_cookie_t);
+       int (*puffs_node_pathconf)(struct puffs_usermount *,
+           puffs_cookie_t, int, int *);
+       int (*puffs_node_advlock)(struct puffs_usermount *,
+           puffs_cookie_t, void *, int, struct flock *, int);
+       int (*puffs_node_read)(struct puffs_usermount *, puffs_cookie_t,
+           uint8_t *, off_t, size_t *, const struct puffs_cred *, int);
+       int (*puffs_node_write)(struct puffs_usermount *, puffs_cookie_t,
+           uint8_t *, off_t, size_t *, const struct puffs_cred *, int);
+       int (*puffs_node_abortop)(struct puffs_usermount *, puffs_cookie_t,
+           const struct puffs_cn *);
+#if 0
+       /* enable next time this structure is changed */
+       void *puffs_ops_spare[32];
+#endif
+};
+
 struct puffs_ops {
        int (*puffs_fs_unmount)(struct puffs_usermount *, int);
        int (*puffs_fs_statvfs)(struct puffs_usermount *, struct statvfs *);
        int (*puffs_fs_sync)(struct puffs_usermount *, int,
@@ -159,8 +235,10 @@
            struct puffs_newinfo *);
        int (*puffs_fs_nodetofh)(struct puffs_usermount *, puffs_cookie_t,
            void *, size_t *);
        void (*puffs_fs_suspend)(struct puffs_usermount *, int);
+       int (*puffs_fs_extattrctl)(struct puffs_usermount *, int,
+           puffs_cookie_t, int, int, const char *);
 
        int (*puffs_node_lookup)(struct puffs_usermount *,
            puffs_cookie_t, struct puffs_newinfo *, const struct puffs_cn *);
        int (*puffs_node_create)(struct puffs_usermount *,
@@ -219,8 +297,17 @@
        int (*puffs_node_write)(struct puffs_usermount *, puffs_cookie_t,
            uint8_t *, off_t, size_t *, const struct puffs_cred *, int);
        int (*puffs_node_abortop)(struct puffs_usermount *, puffs_cookie_t,
            const struct puffs_cn *);
+       int (*puffs_node_getextattr)(struct puffs_usermount *, puffs_cookie_t,
+           int, const char *, size_t *, uint8_t *, size_t *,
+           const struct puffs_cred *);
+       int (*puffs_node_setextattr)(struct puffs_usermount *, puffs_cookie_t,
+           int, const char *, uint8_t *, size_t *, const struct puffs_cred *);
+       int (*puffs_node_listextattr)(struct puffs_usermount *, puffs_cookie_t,
+           int, size_t *, uint8_t *, size_t *, const struct puffs_cred *);
+       int (*puffs_node_deleteextattr)(struct puffs_usermount *,
+           puffs_cookie_t, int, const char *, const struct puffs_cred *);
 
 #if 0
        /* enable next time this structure is changed */
        void *puffs_ops_spare[32];
@@ -289,8 +376,10 @@
            size_t, struct puffs_newinfo *);                            \
        int fsname##_fs_nodetofh(struct puffs_usermount *,              \
            puffs_cookie_t, void *, size_t *);                          \
        void fsname##_fs_suspend(struct puffs_usermount *, int);        \
+       int fsname##_fs_extattrctl(struct puffs_usermount *, int,       \
+           puffs_cookie_t, int, int, const char *);                    \
                                                                        \
        int fsname##_node_lookup(struct puffs_usermount *,              \
            puffs_cookie_t, struct puffs_newinfo *,                     \
            const struct puffs_cn *);                                   \
@@ -357,9 +446,21 @@
        int fsname##_node_write(struct puffs_usermount *,               \
            puffs_cookie_t, uint8_t *, off_t, size_t *,                 \
            const struct puffs_cred *, int);                            \
        int fsname##_node_abortop(struct puffs_usermount *,             \
-           puffs_cookie_t, const struct puffs_cn *);
+           puffs_cookie_t, const struct puffs_cn *);                   \
+       int fsname##_node_getextattr(struct puffs_usermount *,          \
+           puffs_cookie_t, int, const char *, size_t *, uint8_t *,     \
+           size_t *, const struct puffs_cred *);                       \
+       int fsname##_node_setextattr(struct puffs_usermount *,          \
+           puffs_cookie_t, int, const char *, uint8_t *, size_t *,     \
+           const struct puffs_cred *);                                 \
+       int fsname##_node_listextattr(struct puffs_usermount *,         \
+           puffs_cookie_t, int, size_t *, uint8_t *, size_t *,         \
+           const struct puffs_cred *);                                 \
+       int fsname##_node_deleteextattr(struct puffs_usermount *,       \
+           puffs_cookie_t, int, const char *,                          \
+           const struct puffs_cred *);
 
 #define PUFFSOP_INIT(ops)                                              \
     ops = malloc(sizeof(struct puffs_ops));                            \
     memset(ops, 0, sizeof(struct puffs_ops))
@@ -371,9 +472,9 @@
 PUFFSOP_PROTOS(puffs_null)     /* XXX */
 
 #define PUFFS_DEVEL_LIBVERSION 34
 #define puffs_init(a,b,c,d,e) \
-    _puffs_init(PUFFS_DEVEL_LIBVERSION,a,b,c,d,e)
+    _puffs_init52(PUFFS_DEVEL_LIBVERSION,a,b,c,d,e)
 
 
 #define PNPATH(pnode)  ((pnode)->pn_po.po_path)
 #define PNPLEN(pnode)  ((pnode)->pn_po.po_len)
@@ -418,10 +519,12 @@
 
 __BEGIN_DECLS
 
 #define PUFFS_DEFER ((void *)-1)
-struct puffs_usermount *_puffs_init(int, struct puffs_ops *, const char *,
+struct puffs_usermount *_puffs_init(int, struct puffs_ops51 *, const char *,
                                    const char *, void *, uint32_t);
+struct puffs_usermount *_puffs_init52(int, struct puffs_ops *, const char *,
+                                     const char *, void *, uint32_t);
 int            puffs_mount(struct puffs_usermount *, const char *, int, void*);
 int            puffs_exit(struct puffs_usermount *, int);
 void           puffs_cancel(struct puffs_usermount *, int);
 int            puffs_mainloop(struct puffs_usermount *);


Home | Main Index | Thread Index | Old Index