<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>aix &#8211; Strava LTD</title>
	<atom:link href="https://strava.ltd/category/aix/feed/" rel="self" type="application/rss+xml" />
	<link>https://strava.ltd</link>
	<description>Services of IT infrastructure, AIX Operating System and IBM pSeries, IBM Power, PureStorage PureArrays and DevOps Ansible, Terraform, Infrastructure as a Code</description>
	<lastBuildDate>Tue, 03 Mar 2026 20:25:27 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.9.1</generator>

<image>
	<url>https://strava.ltd/wp-content/uploads/2024/02/cropped-logo_strava-140_transparent-32x32.png</url>
	<title>aix &#8211; Strava LTD</title>
	<link>https://strava.ltd</link>
	<width>32</width>
	<height>32</height>
</image> 
	<item>
		<title>AIX: Welcome to the ODM</title>
		<link>https://strava.ltd/2025/09/12/aix-welcome-to-the-odm/</link>
		
		<dc:creator><![CDATA[nicolas]]></dc:creator>
		<pubDate>Fri, 12 Sep 2025 08:30:30 +0000</pubDate>
				<category><![CDATA[aix]]></category>
		<category><![CDATA[C]]></category>
		<guid isPermaLink="false">https://strava.ltd/?p=310</guid>

					<description><![CDATA[AIX friend, aren&#8217;t you proud to be a big boy and to tease your linux kiddos with your big ODM? Let&#8217;s make them cry then. Today we are not going to f@ck around. We use C language baby, yeah! Like many things in C, we start defining a structure, but this structure is a required IBM stuff and it looks this way, store that in a file called create_class.cre: Then, let&#8217;s define some functions in an odm.h file: And then the implementation of these functions in odm.c: Alright, that looks sexy but what do I do with all this mess]]></description>
										<content:encoded><![CDATA[<p>AIX friend, aren&#8217;t you proud to be a big boy and to tease your linux kiddos with your big ODM? Let&#8217;s make them cry then. Today we are not going to f@ck around. We use C language baby, yeah!</p>
<p>Like many things in C, we start defining a structure, but this structure is a required IBM stuff and it looks this way, store that in a file called create_class.cre:</p>
<pre class="brush: cpp; title: ; notranslate">
class mystuff {
  char		Customer&#x5B;100];
  int		ActivationDate;
  int		ExpirationDate;
  char		Key&#x5B;100];
  char		Product&#x5B;100];
  char		Version&#x5B;100];
};
</pre>
<p>Then, let&#8217;s define some functions in an odm.h file:</p>
<pre class="brush: cpp; title: ; notranslate">
#include &lt;stdio.h&gt;
#include &lt;stdlib.h&gt;
#include &lt;odmi.h&gt;
#include &lt;errno.h&gt;
#include &lt;strings.h&gt;
#include &lt;time.h&gt;
#include &lt;unistd.h&gt;

#include &quot;create_class.h&quot;

typedef struct mystuff mystuff_t;

#define TRIAL_PERIOD  2592000

int create_odm_class();
int write_odm();
int check_odm_class();
mystuff_t *read_odm();

</pre>
<p>And then the implementation of these functions in odm.c:</p>
<pre class="brush: cpp; title: ; notranslate">
#include &quot;odm.h&quot;

#ifdef __PPC__

int create_odm_class() {
  char *error_message;

  if(DEBUG&gt;1) printf(&quot;Creation of class mystuff.\n&quot;);
  syslog(LOG_DEBUG, &quot;Creation of ODM class.&quot;);
  if(odm_create_class(mystuff_CLASS)!=0) {
    odm_err_msg ( odmerrno, &amp;error_message );
    if(DEBUG&gt;1) printf(&quot;Problem accessing ODM. %s&quot;, error_message);
    syslog(LOG_ERR, &quot;Problem accessing ODM. %s&quot;, error_message);
    return(1);
  }

  return(0);
}

int write_odm() {
  struct mystuff *data2write;
  data2write=(struct mystuff*)malloc(sizeof(struct mystuff));

  time_t now = time(NULL);

  data2write-&gt;ActivationDate = now;

  odm_add_obj(mystuff_CLASS, data2write);
  return(0);
}

int check_odm_class() {
  char *error_message;

  if(odm_mount_class(&quot;mystuff&quot;)==(CLASS_SYMBOL)-1) {
    odm_err_msg ( odmerrno, &amp;error_message );
    if(DEBUG&gt;1) printf(&quot;&#x5B;check_odm_class] Error searching for class mystuff #%d: %s\n&quot;, odmerrno, error_message);
    syslog(LOG_ERR, &quot;&#x5B;check_odm_class] Error searching for class mystuff #%d: %s&quot;, odmerrno, error_message);
    if(odmerrno==0) {
      create_odm_class();
      write_odm();
    } else {
      if(DEBUG) printf(&quot;&#x5B;create_odm_class] Class mystuff created successfully.\n&quot;);
      syslog(LOG_DEBUG, &quot;&#x5B;create_odm_class] Class mystuff created successfully.&quot;);
    }
  }

  return(0);
}

mystuff_t *read_odm() {
  struct tm ts;
  char buf&#x5B;80];
  mystuff_t *data2read;
  data2read=(struct mystuff*)malloc(sizeof(struct mystuff));

  odm_get_first(mystuff_CLASS, NULL, data2read);
  if(DEBUG&gt;1) {
    ts = *localtime((const time_t *)&amp;data2read-&gt;ActivationDate);
    strftime(buf, sizeof(buf), &quot;%a %Y-%m-%d %H:%M:%S %Z&quot;, &amp;ts);
    printf(&quot;\n&#x5B;read_odm] Activation Date: %ld &#x5B;%s]\n&quot;, data2read-&gt;ActivationDate, buf);
    printf(&quot;&#x5B;read_odm] Customer: %s\n&quot;, data2read-&gt;Customer);
    printf(&quot;&#x5B;read_odm] Key: %s\n&quot;, data2read-&gt;Key);
    printf(&quot;\n&quot;);
  }
  syslog(LOG_DEBUG, &quot;&#x5B;read_odm] Activation Date: %ld; Key: %s&quot;, data2read-&gt;ActivationDate, data2read-&gt;Key);

  return(data2read);
}
</pre>
<p>Alright, that looks sexy but what do I do with all this mess buddy!? That:</p>
<pre class="brush: cpp; title: ; notranslate">
int main(int argc, char **argv) {
  check_odm_class();
  return(0);
}
</pre>
<p>And this is already the time for compilation baby! Here is your Makefile:</p>
<pre class="brush: bash; title: ; notranslate">
CC=gcc
OS ?= $(shell uname -s)
CFLAGS=-g -ggdb -Wall 
LFLAGS=-L/opt/freeware/lib
LDFLAGS=-lodm -lerrlog -lm

SRC:= src

all: mystuff

src/create_class.o:
	/usr/bin/odmcreate -h src/create_class.cre
	$(CC) -g -ggdb  -c src/create_class.c -o src/create_class.o

%.o: $(SRC)/%.c
	$(CC) $(CFLAGS) -c $&lt; -o $@

mystuff: src/create_class.o src/odm.o
	$(CC) $(CFLAGS) $(LFLAGS) $(LDFLAGS) src/main.c src/create_class.o src/odm.o -o build/mystuff 

clean:
	\rm -f build/mystuff src/*.o .toc src/create_class.?

</pre>
<p>If you do not understand it all, do not call me, I am in holidays.<br />
So that means you can literally store anything in the ODM and access and read it back anytime with this set of functions. Be aware that anyone with ODM skills can access them also using the set of get_odm commands. So for sensitive informations, you will need to encrypt that.</p>
<p>Have fun! I&#8217;ll see you next time.</p>
]]></content:encoded>
					
		
		
			</item>
	</channel>
</rss>
