From fd43003403a8447d9f387773e7d6d3f3eb752b43 Mon Sep 17 00:00:00 2001 From: Jay Martinez Date: Thu, 18 Aug 2011 16:09:49 -0700 Subject: [PATCH] OSD-TARGET: Changes to receive an osd name from tgtadm through tgtd and record the osd name. This is patch 2/2. The first patch modifies tgtadm and tgtd to get the osd name as parameter from command line. usage has explained at the first patch [1/2]. Signed-off-by: Jay Martinez --- osd-target/cdb.h | 1 + osd-target/osd.c | 16 ++++++++++++++++ 2 files changed, 17 insertions(+) diff --git a/osd-target/cdb.h b/osd-target/cdb.h index e60b88a..98b98bb 100644 --- a/osd-target/cdb.h +++ b/osd-target/cdb.h @@ -29,5 +29,6 @@ int osdemu_cmd_submit(struct osd_device *osd, uint8_t *cdb, const uint8_t *data_in, uint64_t data_in_len, uint8_t **data_out, uint64_t *data_out_len, uint8_t *sense_out, int *senselen_out); +int osd_set_name(struct osd_device *osd, char *osdname); #endif /* __CDB_H */ diff --git a/osd-target/osd.c b/osd-target/osd.c index a7d9cb1..bb7d0e6 100644 --- a/osd-target/osd.c +++ b/osd-target/osd.c @@ -1084,6 +1084,22 @@ int osd_open(const char *root, struct osd_device *osd) return ret; } +int osd_set_name(struct osd_device *osd, char *osdname) +{ + int ret = 0; + + osd_info("Setting osdname => %s",osdname); + + ret = attr_set_attr(osd->dbc, 0, 0, ROOT_INFO_PG,RIAP_OSD_NAME, + osdname, strlen(osdname)); + + if ( OSD_OK != ret){ + osd_error("!attr_set_attr => %d", ret); + } + + return ret; +} + int osd_close(struct osd_device *osd) { int ret;