r3323: more warning reductions
[bbaumbach/samba-autobuild/.git] / source4 / ntvfs / simple / vfs_simple.c
index faf8f17b780119e6fa73970c4a9ca96c8d1e7c4b..379d24f8485a872b553cd3d9acbabc5cb2f1cb6e 100644 (file)
@@ -508,43 +508,24 @@ static NTSTATUS svfs_write(struct ntvfs_module_context *ntvfs,
 {
        ssize_t ret;
 
-       CHECK_READ_ONLY(req);
+       if (wr->generic.level != RAW_WRITE_WRITEX) {
+               return ntvfs_map_write(req, wr, ntvfs);
+       }
 
-       switch (wr->generic.level) {
-       case RAW_WRITE_WRITEX:
-               ret = pwrite(wr->writex.in.fnum, 
-                            wr->writex.in.data, 
-                            wr->writex.in.count,
-                            wr->writex.in.offset);
-               if (ret == -1) {
-                       return map_nt_error_from_unix(errno);
-               }
-               
-               wr->writex.out.nwritten = ret;
-               wr->writex.out.remaining = 0; /* should fill this in? */
-
-               return NT_STATUS_OK;
-
-       case RAW_WRITE_WRITE:
-               if (wr->write.in.count == 0) {
-                       /* a truncate! */
-                       ret = ftruncate(wr->write.in.fnum, wr->write.in.offset);
-               } else {
-                       ret = pwrite(wr->write.in.fnum, 
-                                    wr->write.in.data, 
-                                    wr->write.in.count,
-                                    wr->write.in.offset);
-               }
-               if (ret == -1) {
-                       return map_nt_error_from_unix(errno);
-               }
-               
-               wr->write.out.nwritten = ret;
+       CHECK_READ_ONLY(req);
 
-               return NT_STATUS_OK;
+       ret = pwrite(wr->writex.in.fnum, 
+                    wr->writex.in.data, 
+                    wr->writex.in.count,
+                    wr->writex.in.offset);
+       if (ret == -1) {
+               return map_nt_error_from_unix(errno);
        }
-
-       return NT_STATUS_NOT_SUPPORTED;
+               
+       wr->writex.out.nwritten = ret;
+       wr->writex.out.remaining = 0; /* should fill this in? */
+       
+       return NT_STATUS_OK;
 }
 
 /*