[PATCH] daxctl: Change region input type from INTEGER to STRING.
by Li, Redhairer
Allow daxctl to accept both <region-id>, and region name as region parameter.
For example:
daxctl list -r region5
daxctl list -r 5
Link: https://github.com/pmem/ndctl/issues/109
Signed-off-by: Redhairer Li <redhairer.li(a)intel.com>
---
daxctl/device.c | 11 ++++-------
daxctl/list.c | 14 ++++++--------
util/filter.c | 16 ++++++++++++++++
util/filter.h | 2 ++
4 files changed, 28 insertions(+), 15 deletions(-)
diff --git a/daxctl/device.c b/daxctl/device.c
index 72e506e..d9db2f9 100644
--- a/daxctl/device.c
+++ b/daxctl/device.c
@@ -19,15 +19,13 @@
static struct {
const char *dev;
const char *mode;
- int region_id;
+ const char *region;
bool no_online;
bool no_movable;
bool force;
bool human;
bool verbose;
-} param = {
- .region_id = -1,
-};
+} param;
enum dev_mode {
DAXCTL_DEV_MODE_UNKNOWN,
@@ -51,7 +49,7 @@ enum device_action {
};
#define BASE_OPTIONS() \
-OPT_INTEGER('r', "region", ¶m.region_id, "restrict to the given region"), \
+OPT_STRING('r', "region", ¶m.region, "region-id", "filter by region"), \
OPT_BOOLEAN('u', "human", ¶m.human, "use human friendly number formats"), \
OPT_BOOLEAN('v', "verbose", ¶m.verbose, "emit more debug messages")
@@ -484,8 +482,7 @@ static int do_xaction_device(const char *device, enum device_action action,
*processed = 0;
daxctl_region_foreach(ctx, region) {
- if (param.region_id >= 0 && param.region_id
- != daxctl_region_get_id(region))
+ if (!util_daxctl_region_filter(region, device))
continue;
daxctl_dev_foreach(region, dev) {
diff --git a/daxctl/list.c b/daxctl/list.c
index e56300d..6c6251b 100644
--- a/daxctl/list.c
+++ b/daxctl/list.c
@@ -44,10 +44,8 @@ static unsigned long listopts_to_flags(void)
static struct {
const char *dev;
- int region_id;
-} param = {
- .region_id = -1,
-};
+ const char *region;
+} param;
static int did_fail;
@@ -66,7 +64,8 @@ static int num_list_flags(void)
int cmd_list(int argc, const char **argv, struct daxctl_ctx *ctx)
{
const struct option options[] = {
- OPT_INTEGER('r', "region", ¶m.region_id, "filter by region"),
+ OPT_STRING('r', "region", ¶m.region, "region-id",
+ "filter by region"),
OPT_STRING('d', "dev", ¶m.dev, "dev-id",
"filter by dax device instance name"),
OPT_BOOLEAN('D', "devices", &list.devs, "include dax device info"),
@@ -94,7 +93,7 @@ int cmd_list(int argc, const char **argv, struct daxctl_ctx *ctx)
usage_with_options(u, options);
if (num_list_flags() == 0) {
- list.regions = param.region_id >= 0;
+ list.regions = !!param.region;
list.devs = !!param.dev;
}
@@ -106,8 +105,7 @@ int cmd_list(int argc, const char **argv, struct daxctl_ctx *ctx)
daxctl_region_foreach(ctx, region) {
struct json_object *jregion = NULL;
- if (param.region_id >= 0 && param.region_id
- != daxctl_region_get_id(region))
+ if (!util_daxctl_region_filter(region, param.region))
continue;
if (list.regions) {
diff --git a/util/filter.c b/util/filter.c
index 1734bce..877d6c7 100644
--- a/util/filter.c
+++ b/util/filter.c
@@ -335,6 +335,22 @@ struct daxctl_dev *util_daxctl_dev_filter(struct daxctl_dev *dev,
return NULL;
}
+struct daxctl_region *util_daxctl_region_filter(struct daxctl_region *region,
+ const char *ident)
+{
+ int region_id;
+
+ if (!ident || strcmp(ident, "all") == 0)
+ return region;
+
+ if ((sscanf(ident, "%d", ®ion_id) == 1
+ || sscanf(ident, "region%d", ®ion_id) == 1)
+ && daxctl_region_get_id(region) == region_id)
+ return region;
+
+ return NULL;
+}
+
static enum ndctl_namespace_mode mode_to_type(const char *mode)
{
if (!mode)
diff --git a/util/filter.h b/util/filter.h
index c2cdddf..0c12b94 100644
--- a/util/filter.h
+++ b/util/filter.h
@@ -37,6 +37,8 @@ struct ndctl_region *util_region_filter_by_namespace(struct ndctl_region *region
const char *ident);
struct daxctl_dev *util_daxctl_dev_filter(struct daxctl_dev *dev,
const char *ident);
+struct daxctl_region *util_daxctl_region_filter(struct daxctl_region *region,
+ const char *ident);
struct json_object;
--
2.20.1.windows.1
1 year
Re: Abandoned Project
by Mr. Peter Brook
Good day.
I am the new EXECUTIVE DIRECTOR and Head of Operations of
Overseas
Credit Commission London, UK. Sometime ago, in
our organization your overdue consignment fund was brought to our
office for final delivery clearance.
However, upon my arrival to this office, I found your consignment
clearance file lying fallow on my desk without any attention. On
a
thorough scrutiny I discovered that your consignment have been
abandoned by your delivery agent. Meanwhile, I have made several
attempts to contact your delivery agent but to no avail. To my
greatest surprise, during my recent routine checking, I
personally
discovered that your consignment content declaration documents
stated
that your consignment contains personal effects meanwhile, it
contains
United States dollar bills worth over US$ 10.5 Million dollars,
which
made it impossible for the consignment to be delivered to you
earlier
before now.
Based on this personal discovery, I am contacting you now to let
you
know that with my position and power in this office, I can assist
you
to legally clear your consignment fund, but you must agree with
the
following conditions:
You must not disclose to any member of my organization whatever
assistance that I am going to render to you in respect of
clearing
this consignment fund into your custody.
You will provide me with an authenticated promissory note, other
wise
known as partnership agreement, that upon the safe arrival of the
consignment fund to your custody, that you give me 40% of the
total
fund contained in the consignment.
You must give adequate attention to this matter until we
successfully
and legally clear the consignment fund into your custody.
Upon your acceptance with my above conditions, I will furnish you
with
further details of what should be done to legally get the
consignment
fund cleared and delivered to you as the rightful owner of the
consignment.
Meanwhile, if you know that you would be unable to keep the
secret of
my assistance to you in this regards, please do not border to
reply.
Hence the consignment fund would be recovered into our
organization
treasury account as unclaimed consignment fund. Be informed that
the
consignment contain the sum of $10.5 million dollars in the
luggage.
But if you can assure me of your competency to keep this secret,
I
would like to hear from you soon as possible so that I can email
you
further details and guidelines.
I am looking forward to your earliest response.
Have a Great Day
Mr. Peter Brook
Head of Operations
1 year
[PATCH 1/1] ndctl, test: add UUID_LIBS for blk_namespaces/pmem_namespaces/device_dax
by redhairer
Some environments automatically include the missing library dependency,
and others need it to be explicitly included.
Signed-off-by: Redhairer Li <redhairer.li(a)intel.com>
---
test/Makefile.am | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/test/Makefile.am b/test/Makefile.am
index 829146d..a13440e 100644
--- a/test/Makefile.am
+++ b/test/Makefile.am
@@ -98,10 +98,10 @@ ack_shutdown_count_set_SOURCES =\
ack_shutdown_count_set_LDADD = $(LIBNDCTL_LIB) $(KMOD_LIBS)
blk_ns_SOURCES = blk_namespaces.c $(testcore)
-blk_ns_LDADD = $(LIBNDCTL_LIB) $(KMOD_LIBS)
+blk_ns_LDADD = $(LIBNDCTL_LIB) $(KMOD_LIBS) $(UUID_LIBS)
pmem_ns_SOURCES = pmem_namespaces.c $(testcore)
-pmem_ns_LDADD = $(LIBNDCTL_LIB) $(KMOD_LIBS)
+pmem_ns_LDADD = $(LIBNDCTL_LIB) $(KMOD_LIBS) $(UUID_LIBS)
dpa_alloc_SOURCES = dpa-alloc.c $(testcore)
dpa_alloc_LDADD = $(LIBNDCTL_LIB) $(UUID_LIBS) $(KMOD_LIBS)
@@ -143,6 +143,7 @@ device_dax_LDADD = \
$(LIBNDCTL_LIB) \
$(KMOD_LIBS) \
$(JSON_LIBS) \
+ $(UUID_LIBS) \
../libutil.a
smart_notify_SOURCES = smart-notify.c
--
2.20.1.windows.1
1 year
[PATCH 1/1] daxctl: Change region input type from INTEGER to STRING.
by redhairer
Allow daxctl to accept both <region-id>, and region name as region parameter.
For example:
daxctl list -r region5
daxctl list -r 5
Link: https://github.com/pmem/ndctl/issues/109
Signed-off-by: Redhairer Li <redhairer.li(a)intel.com>
---
daxctl/device.c | 11 ++++-------
daxctl/list.c | 14 ++++++--------
util/filter.c | 16 ++++++++++++++++
util/filter.h | 2 ++
4 files changed, 28 insertions(+), 15 deletions(-)
diff --git a/daxctl/device.c b/daxctl/device.c
index 72e506e..705f1f8 100644
--- a/daxctl/device.c
+++ b/daxctl/device.c
@@ -19,15 +19,13 @@
static struct {
const char *dev;
const char *mode;
- int region_id;
+ const char *region;
bool no_online;
bool no_movable;
bool force;
bool human;
bool verbose;
-} param = {
- .region_id = -1,
-};
+} param;
enum dev_mode {
DAXCTL_DEV_MODE_UNKNOWN,
@@ -51,7 +49,7 @@ enum device_action {
};
#define BASE_OPTIONS() \
-OPT_INTEGER('r', "region", ¶m.region_id, "restrict to the given region"), \
+OPT_STRING('r', "region", ¶m.region, "region-id", "filter by region"), \
OPT_BOOLEAN('u', "human", ¶m.human, "use human friendly number formats"), \
OPT_BOOLEAN('v', "verbose", ¶m.verbose, "emit more debug messages")
@@ -484,8 +482,7 @@ static int do_xaction_device(const char *device, enum device_action action,
*processed = 0;
daxctl_region_foreach(ctx, region) {
- if (param.region_id >= 0 && param.region_id
- != daxctl_region_get_id(region))
+ if (!util_daxctl_region_filter(region, param.region))
continue;
daxctl_dev_foreach(region, dev) {
diff --git a/daxctl/list.c b/daxctl/list.c
index e56300d..6c6251b 100644
--- a/daxctl/list.c
+++ b/daxctl/list.c
@@ -44,10 +44,8 @@ static unsigned long listopts_to_flags(void)
static struct {
const char *dev;
- int region_id;
-} param = {
- .region_id = -1,
-};
+ const char *region;
+} param;
static int did_fail;
@@ -66,7 +64,8 @@ static int num_list_flags(void)
int cmd_list(int argc, const char **argv, struct daxctl_ctx *ctx)
{
const struct option options[] = {
- OPT_INTEGER('r', "region", ¶m.region_id, "filter by region"),
+ OPT_STRING('r', "region", ¶m.region, "region-id",
+ "filter by region"),
OPT_STRING('d', "dev", ¶m.dev, "dev-id",
"filter by dax device instance name"),
OPT_BOOLEAN('D', "devices", &list.devs, "include dax device info"),
@@ -94,7 +93,7 @@ int cmd_list(int argc, const char **argv, struct daxctl_ctx *ctx)
usage_with_options(u, options);
if (num_list_flags() == 0) {
- list.regions = param.region_id >= 0;
+ list.regions = !!param.region;
list.devs = !!param.dev;
}
@@ -106,8 +105,7 @@ int cmd_list(int argc, const char **argv, struct daxctl_ctx *ctx)
daxctl_region_foreach(ctx, region) {
struct json_object *jregion = NULL;
- if (param.region_id >= 0 && param.region_id
- != daxctl_region_get_id(region))
+ if (!util_daxctl_region_filter(region, param.region))
continue;
if (list.regions) {
diff --git a/util/filter.c b/util/filter.c
index 1734bce..877d6c7 100644
--- a/util/filter.c
+++ b/util/filter.c
@@ -335,6 +335,22 @@ struct daxctl_dev *util_daxctl_dev_filter(struct daxctl_dev *dev,
return NULL;
}
+struct daxctl_region *util_daxctl_region_filter(struct daxctl_region *region,
+ const char *ident)
+{
+ int region_id;
+
+ if (!ident || strcmp(ident, "all") == 0)
+ return region;
+
+ if ((sscanf(ident, "%d", ®ion_id) == 1
+ || sscanf(ident, "region%d", ®ion_id) == 1)
+ && daxctl_region_get_id(region) == region_id)
+ return region;
+
+ return NULL;
+}
+
static enum ndctl_namespace_mode mode_to_type(const char *mode)
{
if (!mode)
diff --git a/util/filter.h b/util/filter.h
index c2cdddf..0c12b94 100644
--- a/util/filter.h
+++ b/util/filter.h
@@ -37,6 +37,8 @@ struct ndctl_region *util_region_filter_by_namespace(struct ndctl_region *region
const char *ident);
struct daxctl_dev *util_daxctl_dev_filter(struct daxctl_dev *dev,
const char *ident);
+struct daxctl_region *util_daxctl_region_filter(struct daxctl_region *region,
+ const char *ident);
struct json_object;
--
2.20.1.windows.1
1 year
Greetings
by Mr. Moon David
Dear Sir/Madam,
I have investor that want to invest $6.8 Billion into a company that
needs fund for expansion only.He can not invest the money to new
Companies that want to start up but into Companies that has been
making good profits but needs funds for EXPANSION. He can only invest
in start up if the investment proposal is realistic. The investor is a
former Petroleum Minister.
His Area of concentrations are Real Estate, Biotech,Textiles ,
Information technology, Pharmaceuticals , Oil & Energy Industries,
Mining &Metals Industry, Management Consulting Industry ,Maritime
industry, Hospital & Health Care Industry, Consumer Services Industry,
International Trade and Development Industry ,Gambling & Casinos
Industry, Electrical/Electronic Manufacturing Industry, Insurance
Industry, Chemical industries, Marketing and Advertising Industry,
Leisure, Travel & Tourism Industry, Agriculture, Aviation, Retail,
Import and Export, Trade and development industry, Real Estate &
Construction Industry and any other viable investment opportunities.
If you recommend a Company to take loan or investment funds from from
my client the investor, me and you will be entitled to 5% of any
amount received by the Company from the investor but if you are taking
the fund directly as a company i will be entitled to 2.5% and you will
retain 2.5% as Global Finder's fee commission. There will be a face to
face meeting between the investor and the investee after signing (MOU)
the (AORI) should not be less than 3% per annul if it's loan or direct
project financing.
Look for a reliable Company that need funding and we can easily make
5% of the amount received from the investor but we need to maintain
absolute confidentiality in the transaction as the fund provider want
to remain silent, so you have to keep it highly confidential between
us.
I will need the company profile and the project summary of the company
that will need funding to present to my investor.
I look forward to hearing from you.
Mr. Moon David.
1 year
Custom logo gifts/USB Flash Drive Factory/Amy
by Amy
HI,
We wish you a happy Christmas in advance.
Now custom gift USB flash drives, anticipation, print logos, store data for free.
Model: USB-A-100
Print any logo
Capacity: 1G-128G
MOQ: 150pcs.
Transportation: DHL
Market: Global
Save data for free
Contact me.
Thanks and Best Regards,
Amy
USB Flash Drive Supplier
amy@usbflashdrive-factory.com,amy.job.1985@hotmail.com
www.usbflashdrive-factory.com
Wechat: tuweitian2000
linux-nvdimm(a)lists.01.org
1 year