dm-ioctl.c (1134e5ae79bab61c05657ca35a6297cf87202e35) dm-ioctl.c (3ac51e741a46af7a20f55e79d3e3aeaa93c6c544)
1/*
2 * Copyright (C) 2001, 2002 Sistina Software (UK) Limited.
3 * Copyright (C) 2004 - 2005 Red Hat, Inc. All rights reserved.
4 *
5 * This file is released under the GPL.
6 */
7
8#include "dm.h"
9
10#include <linux/module.h>
11#include <linux/vmalloc.h>
12#include <linux/miscdevice.h>
13#include <linux/init.h>
14#include <linux/wait.h>
15#include <linux/slab.h>
16#include <linux/devfs_fs_kernel.h>
17#include <linux/dm-ioctl.h>
1/*
2 * Copyright (C) 2001, 2002 Sistina Software (UK) Limited.
3 * Copyright (C) 2004 - 2005 Red Hat, Inc. All rights reserved.
4 *
5 * This file is released under the GPL.
6 */
7
8#include "dm.h"
9
10#include <linux/module.h>
11#include <linux/vmalloc.h>
12#include <linux/miscdevice.h>
13#include <linux/init.h>
14#include <linux/wait.h>
15#include <linux/slab.h>
16#include <linux/devfs_fs_kernel.h>
17#include <linux/dm-ioctl.h>
18#include <linux/hdreg.h>
18
19#include <asm/uaccess.h>
20
21#define DM_DRIVER_EMAIL "dm-devel@redhat.com"
22
23/*-----------------------------------------------------------------
24 * The ioctl interface needs to be able to look up devices by
25 * name or uuid.

--- 669 unchanged lines hidden (view full) ---

695 r = check_name(new_name);
696 if (r)
697 return r;
698
699 param->data_size = 0;
700 return dm_hash_rename(param->name, new_name);
701}
702
19
20#include <asm/uaccess.h>
21
22#define DM_DRIVER_EMAIL "dm-devel@redhat.com"
23
24/*-----------------------------------------------------------------
25 * The ioctl interface needs to be able to look up devices by
26 * name or uuid.

--- 669 unchanged lines hidden (view full) ---

696 r = check_name(new_name);
697 if (r)
698 return r;
699
700 param->data_size = 0;
701 return dm_hash_rename(param->name, new_name);
702}
703
704static int dev_set_geometry(struct dm_ioctl *param, size_t param_size)
705{
706 int r = -EINVAL, x;
707 struct mapped_device *md;
708 struct hd_geometry geometry;
709 unsigned long indata[4];
710 char *geostr = (char *) param + param->data_start;
711
712 md = find_device(param);
713 if (!md)
714 return -ENXIO;
715
716 if (geostr < (char *) (param + 1) ||
717 invalid_str(geostr, (void *) param + param_size)) {
718 DMWARN("Invalid geometry supplied.");
719 goto out;
720 }
721
722 x = sscanf(geostr, "%lu %lu %lu %lu", indata,
723 indata + 1, indata + 2, indata + 3);
724
725 if (x != 4) {
726 DMWARN("Unable to interpret geometry settings.");
727 goto out;
728 }
729
730 if (indata[0] > 65535 || indata[1] > 255 ||
731 indata[2] > 255 || indata[3] > ULONG_MAX) {
732 DMWARN("Geometry exceeds range limits.");
733 goto out;
734 }
735
736 geometry.cylinders = indata[0];
737 geometry.heads = indata[1];
738 geometry.sectors = indata[2];
739 geometry.start = indata[3];
740
741 r = dm_set_geometry(md, &geometry);
742 if (!r)
743 r = __dev_status(md, param);
744
745 param->data_size = 0;
746
747out:
748 dm_put(md);
749 return r;
750}
751
703static int do_suspend(struct dm_ioctl *param)
704{
705 int r = 0;
706 int do_lockfs = 1;
707 struct mapped_device *md;
708
709 md = find_device(param);
710 if (!md)

--- 518 unchanged lines hidden (view full) ---

1229
1230 {DM_TABLE_LOAD_CMD, table_load},
1231 {DM_TABLE_CLEAR_CMD, table_clear},
1232 {DM_TABLE_DEPS_CMD, table_deps},
1233 {DM_TABLE_STATUS_CMD, table_status},
1234
1235 {DM_LIST_VERSIONS_CMD, list_versions},
1236
752static int do_suspend(struct dm_ioctl *param)
753{
754 int r = 0;
755 int do_lockfs = 1;
756 struct mapped_device *md;
757
758 md = find_device(param);
759 if (!md)

--- 518 unchanged lines hidden (view full) ---

1278
1279 {DM_TABLE_LOAD_CMD, table_load},
1280 {DM_TABLE_CLEAR_CMD, table_clear},
1281 {DM_TABLE_DEPS_CMD, table_deps},
1282 {DM_TABLE_STATUS_CMD, table_status},
1283
1284 {DM_LIST_VERSIONS_CMD, list_versions},
1285
1237 {DM_TARGET_MSG_CMD, target_message}
1286 {DM_TARGET_MSG_CMD, target_message},
1287 {DM_DEV_SET_GEOMETRY_CMD, dev_set_geometry}
1238 };
1239
1240 return (cmd >= ARRAY_SIZE(_ioctls)) ? NULL : _ioctls[cmd].fn;
1241}
1242
1243/*
1244 * As well as checking the version compatibility this always
1245 * copies the kernel interface version out.

--- 204 unchanged lines hidden ---
1288 };
1289
1290 return (cmd >= ARRAY_SIZE(_ioctls)) ? NULL : _ioctls[cmd].fn;
1291}
1292
1293/*
1294 * As well as checking the version compatibility this always
1295 * copies the kernel interface version out.

--- 204 unchanged lines hidden ---