ANDROID: dm: android-verity: rebase for 4.9
authorBadhri Jagan Sridharan <Badhri@google.com>
Fri, 13 Jan 2017 19:05:00 +0000 (11:05 -0800)
committerAmit Pundir <amit.pundir@linaro.org>
Mon, 18 Dec 2017 15:41:22 +0000 (21:11 +0530)
Export the direct_access method of dm_linear target for
dm-android-verity target.

Signed-off-by: Badhri Jagan Sridharan <Badhri@google.com>
Change-Id: I46556d882305e5194352946264cbc9c06e5038e4

[AmitP: Rebased the changes for v4.14]
Signed-off-by: Amit Pundir <amit.pundir@linaro.org>
drivers/md/dm-android-verity.c
drivers/md/dm-android-verity.h
drivers/md/dm-linear.c

index bb6c1285e499b466b3d5d2b216eb52e3c50f3965..6f616fdf3b736db270256627f585606def327bbf 100644 (file)
@@ -633,8 +633,11 @@ static int add_as_linear_device(struct dm_target *ti, char *dev)
        android_verity_target.dtr = dm_linear_dtr,
        android_verity_target.map = dm_linear_map,
        android_verity_target.status = dm_linear_status,
+       android_verity_target.end_io = dm_linear_end_io,
        android_verity_target.prepare_ioctl = dm_linear_prepare_ioctl,
        android_verity_target.iterate_devices = dm_linear_iterate_devices,
+        android_verity_target.direct_access = dm_linear_dax_direct_access,
+        android_verity_target.dax_copy_from_iter = dm_linear_dax_copy_from_iter,
        android_verity_target.io_hints = NULL;
 
        err = dm_linear_ctr(ti, DM_LINEAR_ARGS, linear_table_args);
index 0c7ff6afec69c04f41f0c7ab6762777004f96d74..ed67d567f3eeb8c2757a4230c563931e3a290fab 100644 (file)
@@ -111,6 +111,8 @@ extern struct target_type linear_target;
 
 extern void dm_linear_dtr(struct dm_target *ti);
 extern int dm_linear_map(struct dm_target *ti, struct bio *bio);
+extern int dm_linear_end_io(struct dm_target *ti, struct bio *bio,
+                        blk_status_t *error);
 extern void dm_linear_status(struct dm_target *ti, status_type_t type,
                        unsigned status_flags, char *result, unsigned maxlen);
 extern int dm_linear_prepare_ioctl(struct dm_target *ti,
@@ -118,4 +120,8 @@ extern int dm_linear_prepare_ioctl(struct dm_target *ti,
 extern int dm_linear_iterate_devices(struct dm_target *ti,
                        iterate_devices_callout_fn fn, void *data);
 extern int dm_linear_ctr(struct dm_target *ti, unsigned int argc, char **argv);
+extern long dm_linear_dax_direct_access(struct dm_target *ti, sector_t sector,
+                                 void **kaddr, pfn_t *pfn, long size);
+extern size_t dm_linear_dax_copy_from_iter(struct dm_target *ti, pgoff_t pgoff,
+               void *addr, size_t bytes, struct iov_iter *i);
 #endif /* DM_ANDROID_VERITY_H */
index 09a4ba6ddf83219a75f2a6e18db113e9d6761453..e6fd31b03c38a4d4f8684d03f95c36820ae0cebb 100644 (file)
@@ -101,7 +101,7 @@ int dm_linear_map(struct dm_target *ti, struct bio *bio)
        return DM_MAPIO_REMAPPED;
 }
 
-static int linear_end_io(struct dm_target *ti, struct bio *bio,
+int dm_linear_end_io(struct dm_target *ti, struct bio *bio,
                         blk_status_t *error)
 {
        struct linear_c *lc = ti->private;
@@ -111,6 +111,7 @@ static int linear_end_io(struct dm_target *ti, struct bio *bio,
 
        return DM_ENDIO_DONE;
 }
+EXPORT_SYMBOL_GPL(dm_linear_end_io);
 
 void dm_linear_status(struct dm_target *ti, status_type_t type,
                          unsigned status_flags, char *result, unsigned maxlen)
@@ -154,7 +155,7 @@ int dm_linear_iterate_devices(struct dm_target *ti,
        return fn(ti, lc->dev, lc->start, ti->len, data);
 }
 
-static long linear_dax_direct_access(struct dm_target *ti, pgoff_t pgoff,
+long dm_linear_dax_direct_access(struct dm_target *ti, pgoff_t pgoff,
                long nr_pages, void **kaddr, pfn_t *pfn)
 {
        long ret;
@@ -169,8 +170,9 @@ static long linear_dax_direct_access(struct dm_target *ti, pgoff_t pgoff,
                return ret;
        return dax_direct_access(dax_dev, pgoff, nr_pages, kaddr, pfn);
 }
+EXPORT_SYMBOL_GPL(dm_linear_dax_direct_access);
 
-static size_t linear_dax_copy_from_iter(struct dm_target *ti, pgoff_t pgoff,
+size_t dm_linear_dax_copy_from_iter(struct dm_target *ti, pgoff_t pgoff,
                void *addr, size_t bytes, struct iov_iter *i)
 {
        struct linear_c *lc = ti->private;
@@ -183,6 +185,7 @@ static size_t linear_dax_copy_from_iter(struct dm_target *ti, pgoff_t pgoff,
                return 0;
        return dax_copy_from_iter(dax_dev, pgoff, addr, bytes, i);
 }
+EXPORT_SYMBOL_GPL(dm_linear_dax_copy_from_iter);
 
 static struct target_type linear_target = {
        .name   = "linear",
@@ -193,11 +196,11 @@ static struct target_type linear_target = {
        .dtr    = dm_linear_dtr,
        .map    = dm_linear_map,
        .status = dm_linear_status,
-       .end_io = linear_end_io,
+       .end_io = dm_linear_end_io,
        .prepare_ioctl = dm_linear_prepare_ioctl,
        .iterate_devices = dm_linear_iterate_devices,
-       .direct_access = linear_dax_direct_access,
-       .dax_copy_from_iter = linear_dax_copy_from_iter,
+       .direct_access = dm_linear_dax_direct_access,
+       .dax_copy_from_iter = dm_linear_dax_copy_from_iter,
 };
 
 int __init dm_linear_init(void)