Print this page
7127  remove -Wno-missing-braces from Makefile.uts


 155 struct vfsops *dc_vfsops;
 156 
 157 static vfsdef_t vfw = {
 158         VFSDEF_VERSION,
 159         "dcfs",
 160         dcinit,
 161         VSW_ZMOUNT,
 162         NULL
 163 };
 164 
 165 /*
 166  * Module linkage information for the kernel.
 167  */
 168 extern struct mod_ops mod_fsops;
 169 
 170 static struct modlfs modlfs = {
 171         &mod_fsops, "compressed filesystem", &vfw
 172 };
 173 
 174 static struct modlinkage modlinkage = {
 175         MODREV_1, (void *)&modlfs, NULL
 176 };
 177 
 178 int
 179 _init()
 180 {
 181         return (mod_install(&modlinkage));
 182 }
 183 
 184 int
 185 _info(struct modinfo *modinfop)
 186 {
 187         return (mod_info(&modlinkage, modinfop));
 188 }
 189 
 190 
 191 static int dc_open(struct vnode **, int, struct cred *, caller_context_t *);
 192 static int dc_close(struct vnode *, int, int, offset_t,
 193     struct cred *, caller_context_t *);
 194 static int dc_read(struct vnode *, struct uio *, int, struct cred *,
 195     struct caller_context *);


 204 static int dc_fid(struct vnode *, struct fid *, caller_context_t *);
 205 static int dc_seek(struct vnode *, offset_t, offset_t *, caller_context_t *);
 206 static int dc_frlock(struct vnode *, int, struct flock64 *, int, offset_t,
 207     struct flk_callback *, struct cred *, caller_context_t *);
 208 static int dc_realvp(struct vnode *, struct vnode **, caller_context_t *);
 209 static int dc_getpage(struct vnode *, offset_t, size_t, uint_t *,
 210     struct page **, size_t, struct seg *, caddr_t, enum seg_rw,
 211     struct cred *, caller_context_t *);
 212 static int dc_putpage(struct vnode *, offset_t, size_t, int,
 213     struct cred *, caller_context_t *);
 214 static int dc_map(struct vnode *, offset_t, struct as *, caddr_t *, size_t,
 215     uchar_t, uchar_t, uint_t, struct cred *, caller_context_t *);
 216 static int dc_addmap(struct vnode *, offset_t, struct as *, caddr_t, size_t,
 217     uchar_t, uchar_t, uint_t, struct cred *, caller_context_t *);
 218 static int dc_delmap(struct vnode *, offset_t, struct as *, caddr_t, size_t,
 219     uint_t, uint_t, uint_t, struct cred *, caller_context_t *);
 220 
 221 struct vnodeops *dc_vnodeops;
 222 
 223 const fs_operation_def_t dc_vnodeops_template[] = {
 224         VOPNAME_OPEN,                   { .vop_open = dc_open },
 225         VOPNAME_CLOSE,                  { .vop_close = dc_close },
 226         VOPNAME_READ,                   { .vop_read = dc_read },
 227         VOPNAME_GETATTR,                { .vop_getattr =  dc_getattr },
 228         VOPNAME_SETATTR,                { .vop_setattr = dc_setattr },
 229         VOPNAME_ACCESS,                 { .vop_access = dc_access },
 230         VOPNAME_FSYNC,                  { .vop_fsync = dc_fsync },
 231         VOPNAME_INACTIVE,               { .vop_inactive = dc_inactive },
 232         VOPNAME_FID,                    { .vop_fid = dc_fid },
 233         VOPNAME_SEEK,                   { .vop_seek = dc_seek },
 234         VOPNAME_FRLOCK,                 { .vop_frlock = dc_frlock },
 235         VOPNAME_REALVP,                 { .vop_realvp = dc_realvp },
 236         VOPNAME_GETPAGE,                { .vop_getpage = dc_getpage },
 237         VOPNAME_PUTPAGE,                { .vop_putpage = dc_putpage },
 238         VOPNAME_MAP,                    { .vop_map = dc_map },
 239         VOPNAME_ADDMAP,                 { .vop_addmap = dc_addmap },
 240         VOPNAME_DELMAP,                 { .vop_delmap = dc_delmap },
 241         NULL,                           NULL
 242 };
 243 
 244 /*ARGSUSED*/
 245 static int
 246 dc_open(struct vnode **vpp, int flag, struct cred *cr, caller_context_t *ctp)
 247 {
 248         return (0);
 249 }
 250 
 251 /*ARGSUSED*/
 252 static int
 253 dc_close(struct vnode *vp, int flag, int count, offset_t off,
 254     struct cred *cr, caller_context_t *ctp)
 255 {
 256         (void) cleanlocks(vp, ttoproc(curthread)->p_pid, 0);
 257         cleanshares(vp, ttoproc(curthread)->p_pid);
 258         return (0);
 259 }
 260 
 261 /*ARGSUSED*/


 866         vp = DCTOV(dp);
 867 
 868         VN_RELE(dp->dc_subvp);
 869         dp->dc_subvp = NULL;
 870         (void) pvn_vplist_dirty(vp, 0, dc_putapage, B_INVAL, NULL);
 871         kmem_free(dp->dc_hdr, dp->dc_hdrsize);
 872         dp->dc_hdr = NULL;
 873         dp->dc_hdrsize = dp->dc_zmax = 0;
 874         dp->dc_bufcache = NULL;
 875         dp->dc_mapcnt = 0;
 876         vn_reinit(vp);
 877         vp->v_type = VREG;
 878         vp->v_flag = VNOSWAP;
 879         vp->v_vfsp = &dc_vfs;
 880 }
 881 
 882 static int
 883 dcinit(int fstype, char *name)
 884 {
 885         static const fs_operation_def_t dc_vfsops_template[] = {
 886                 NULL, NULL
 887         };
 888         int error;
 889         major_t dev;
 890 
 891         error = vfs_setfsops(fstype, dc_vfsops_template, &dc_vfsops);
 892         if (error) {
 893                 cmn_err(CE_WARN, "dcinit: bad vfs ops template");
 894                 return (error);
 895         }
 896         VFS_INIT(&dc_vfs, dc_vfsops, NULL);
 897         dc_vfs.vfs_flag = VFS_RDONLY;
 898         dc_vfs.vfs_fstype = fstype;
 899         if ((dev = getudev()) == (major_t)-1)
 900                 dev = 0;
 901         dcdev = makedevice(dev, 0);
 902         dc_vfs.vfs_dev = dcdev;
 903 
 904         error = vn_make_ops(name, dc_vnodeops_template, &dc_vnodeops);
 905         if (error != 0) {
 906                 (void) vfs_freevfsops_by_type(fstype);




 155 struct vfsops *dc_vfsops;
 156 
 157 static vfsdef_t vfw = {
 158         VFSDEF_VERSION,
 159         "dcfs",
 160         dcinit,
 161         VSW_ZMOUNT,
 162         NULL
 163 };
 164 
 165 /*
 166  * Module linkage information for the kernel.
 167  */
 168 extern struct mod_ops mod_fsops;
 169 
 170 static struct modlfs modlfs = {
 171         &mod_fsops, "compressed filesystem", &vfw
 172 };
 173 
 174 static struct modlinkage modlinkage = {
 175         MODREV_1, { (void *)&modlfs, NULL }
 176 };
 177 
 178 int
 179 _init()
 180 {
 181         return (mod_install(&modlinkage));
 182 }
 183 
 184 int
 185 _info(struct modinfo *modinfop)
 186 {
 187         return (mod_info(&modlinkage, modinfop));
 188 }
 189 
 190 
 191 static int dc_open(struct vnode **, int, struct cred *, caller_context_t *);
 192 static int dc_close(struct vnode *, int, int, offset_t,
 193     struct cred *, caller_context_t *);
 194 static int dc_read(struct vnode *, struct uio *, int, struct cred *,
 195     struct caller_context *);


 204 static int dc_fid(struct vnode *, struct fid *, caller_context_t *);
 205 static int dc_seek(struct vnode *, offset_t, offset_t *, caller_context_t *);
 206 static int dc_frlock(struct vnode *, int, struct flock64 *, int, offset_t,
 207     struct flk_callback *, struct cred *, caller_context_t *);
 208 static int dc_realvp(struct vnode *, struct vnode **, caller_context_t *);
 209 static int dc_getpage(struct vnode *, offset_t, size_t, uint_t *,
 210     struct page **, size_t, struct seg *, caddr_t, enum seg_rw,
 211     struct cred *, caller_context_t *);
 212 static int dc_putpage(struct vnode *, offset_t, size_t, int,
 213     struct cred *, caller_context_t *);
 214 static int dc_map(struct vnode *, offset_t, struct as *, caddr_t *, size_t,
 215     uchar_t, uchar_t, uint_t, struct cred *, caller_context_t *);
 216 static int dc_addmap(struct vnode *, offset_t, struct as *, caddr_t, size_t,
 217     uchar_t, uchar_t, uint_t, struct cred *, caller_context_t *);
 218 static int dc_delmap(struct vnode *, offset_t, struct as *, caddr_t, size_t,
 219     uint_t, uint_t, uint_t, struct cred *, caller_context_t *);
 220 
 221 struct vnodeops *dc_vnodeops;
 222 
 223 const fs_operation_def_t dc_vnodeops_template[] = {
 224         { VOPNAME_OPEN,                 { .vop_open = dc_open } },
 225         { VOPNAME_CLOSE,                { .vop_close = dc_close } },
 226         { VOPNAME_READ,                 { .vop_read = dc_read } },
 227         { VOPNAME_GETATTR,              { .vop_getattr =  dc_getattr } },
 228         { VOPNAME_SETATTR,              { .vop_setattr = dc_setattr } },
 229         { VOPNAME_ACCESS,               { .vop_access = dc_access } },
 230         { VOPNAME_FSYNC,                { .vop_fsync = dc_fsync } },
 231         { VOPNAME_INACTIVE,             { .vop_inactive = dc_inactive } },
 232         { VOPNAME_FID,                  { .vop_fid = dc_fid } },
 233         { VOPNAME_SEEK,                 { .vop_seek = dc_seek } },
 234         { VOPNAME_FRLOCK,               { .vop_frlock = dc_frlock } },
 235         { VOPNAME_REALVP,               { .vop_realvp = dc_realvp } },
 236         { VOPNAME_GETPAGE,              { .vop_getpage = dc_getpage } },
 237         { VOPNAME_PUTPAGE,              { .vop_putpage = dc_putpage } },
 238         { VOPNAME_MAP,                  { .vop_map = dc_map } },
 239         { VOPNAME_ADDMAP,               { .vop_addmap = dc_addmap } },
 240         { VOPNAME_DELMAP,               { .vop_delmap = dc_delmap } },
 241         { NULL,                         { NULL } }
 242 };
 243 
 244 /*ARGSUSED*/
 245 static int
 246 dc_open(struct vnode **vpp, int flag, struct cred *cr, caller_context_t *ctp)
 247 {
 248         return (0);
 249 }
 250 
 251 /*ARGSUSED*/
 252 static int
 253 dc_close(struct vnode *vp, int flag, int count, offset_t off,
 254     struct cred *cr, caller_context_t *ctp)
 255 {
 256         (void) cleanlocks(vp, ttoproc(curthread)->p_pid, 0);
 257         cleanshares(vp, ttoproc(curthread)->p_pid);
 258         return (0);
 259 }
 260 
 261 /*ARGSUSED*/


 866         vp = DCTOV(dp);
 867 
 868         VN_RELE(dp->dc_subvp);
 869         dp->dc_subvp = NULL;
 870         (void) pvn_vplist_dirty(vp, 0, dc_putapage, B_INVAL, NULL);
 871         kmem_free(dp->dc_hdr, dp->dc_hdrsize);
 872         dp->dc_hdr = NULL;
 873         dp->dc_hdrsize = dp->dc_zmax = 0;
 874         dp->dc_bufcache = NULL;
 875         dp->dc_mapcnt = 0;
 876         vn_reinit(vp);
 877         vp->v_type = VREG;
 878         vp->v_flag = VNOSWAP;
 879         vp->v_vfsp = &dc_vfs;
 880 }
 881 
 882 static int
 883 dcinit(int fstype, char *name)
 884 {
 885         static const fs_operation_def_t dc_vfsops_template[] = {
 886                 { NULL, { NULL } }
 887         };
 888         int error;
 889         major_t dev;
 890 
 891         error = vfs_setfsops(fstype, dc_vfsops_template, &dc_vfsops);
 892         if (error) {
 893                 cmn_err(CE_WARN, "dcinit: bad vfs ops template");
 894                 return (error);
 895         }
 896         VFS_INIT(&dc_vfs, dc_vfsops, NULL);
 897         dc_vfs.vfs_flag = VFS_RDONLY;
 898         dc_vfs.vfs_fstype = fstype;
 899         if ((dev = getudev()) == (major_t)-1)
 900                 dev = 0;
 901         dcdev = makedevice(dev, 0);
 902         dc_vfs.vfs_dev = dcdev;
 903 
 904         error = vn_make_ops(name, dc_vnodeops_template, &dc_vnodeops);
 905         if (error != 0) {
 906                 (void) vfs_freevfsops_by_type(fstype);