Print this page
5045 use atomic_{inc,dec}_* instead of atomic_add_*


 184 {
 185         sharefs_vfs_t   *data;
 186         dev_t           dev;
 187 
 188         if (secpolicy_fs_mount(cr, mvp, vfsp) != 0)
 189                 return (EPERM);
 190 
 191         if ((uap->flags & MS_OVERLAY) == 0 &&
 192             (mvp->v_count > 1 || (mvp->v_flag & VROOT)))
 193                 return (EBUSY);
 194 
 195         data = kmem_alloc(sizeof (sharefs_vfs_t), KM_SLEEP);
 196 
 197         /*
 198          * Initialize vfs fields
 199          */
 200         vfsp->vfs_bsize = DEV_BSIZE;
 201         vfsp->vfs_fstype = sharefs_fstype;
 202         do {
 203                 dev = makedevice(sharefs_major,
 204                     atomic_add_32_nv(&sharefs_minor, 1) & L_MAXMIN32);
 205         } while (vfs_devismounted(dev));
 206         vfs_make_fsid(&vfsp->vfs_fsid, dev, sharefs_fstype);
 207         vfsp->vfs_data = data;
 208         vfsp->vfs_dev = dev;
 209 
 210         /*
 211          * Create root
 212          */
 213         data->sharefs_vfs_root = sharefs_create_root_file(vfsp);
 214 
 215         return (0);
 216 }
 217 
 218 static int
 219 sharefs_unmount(vfs_t *vfsp, int flag, struct cred *cr)
 220 {
 221         sharefs_vfs_t   *data;
 222 
 223         if (secpolicy_fs_unmount(cr, vfsp) != 0)
 224                 return (EPERM);




 184 {
 185         sharefs_vfs_t   *data;
 186         dev_t           dev;
 187 
 188         if (secpolicy_fs_mount(cr, mvp, vfsp) != 0)
 189                 return (EPERM);
 190 
 191         if ((uap->flags & MS_OVERLAY) == 0 &&
 192             (mvp->v_count > 1 || (mvp->v_flag & VROOT)))
 193                 return (EBUSY);
 194 
 195         data = kmem_alloc(sizeof (sharefs_vfs_t), KM_SLEEP);
 196 
 197         /*
 198          * Initialize vfs fields
 199          */
 200         vfsp->vfs_bsize = DEV_BSIZE;
 201         vfsp->vfs_fstype = sharefs_fstype;
 202         do {
 203                 dev = makedevice(sharefs_major,
 204                     atomic_inc_32_nv(&sharefs_minor) & L_MAXMIN32);
 205         } while (vfs_devismounted(dev));
 206         vfs_make_fsid(&vfsp->vfs_fsid, dev, sharefs_fstype);
 207         vfsp->vfs_data = data;
 208         vfsp->vfs_dev = dev;
 209 
 210         /*
 211          * Create root
 212          */
 213         data->sharefs_vfs_root = sharefs_create_root_file(vfsp);
 214 
 215         return (0);
 216 }
 217 
 218 static int
 219 sharefs_unmount(vfs_t *vfsp, int flag, struct cred *cr)
 220 {
 221         sharefs_vfs_t   *data;
 222 
 223         if (secpolicy_fs_unmount(cr, vfsp) != 0)
 224                 return (EPERM);